home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / DB_CLIPP / 2510.ZIP / TRSOURCE.EXE / EXPONENT.C < prev    next >
C/C++ Source or Header  |  1990-10-22  |  544b  |  29 lines

  1. /*********
  2. * EXPONENT.C
  3. *
  4. * by Ralph Davis
  5. * modified by Tom Rettig
  6. *
  7. * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
  8. *
  9. *  Syntax:  EXPONENT( <expN> )
  10. *  Return:  Power of 2 used to represent <expN> in memory
  11. *********/
  12.  
  13. #include "trlib.h"
  14.  
  15. TRTYPE exponent()
  16. {
  17.    if ( PCOUNT==1 && ISNUM(1) )
  18.    {
  19.       int    expon = 0;
  20.       double result, n;
  21.  
  22.       n = _parnd(1);
  23.       result = _tr_frexp(n,&expon);  /* Returns exponent in expon */
  24.       _retni(expon);
  25.    }
  26.    else
  27.       _retni( ERROR );
  28. }
  29.